package frog.lazy.framework.core.provider;


import java.util.Collection;
import java.util.List;
import java.util.Set;
import java.util.concurrent.TimeUnit;

public interface IRedisProvider {

    /* ----------- common --------- */
    Collection<String> keys(String pattern);

    void delete(String key);

    void delete(Collection<String> key);

    Long getExpire(String key);

    /*-------------hash-----------------*/
    <T> void hashPut(String k, Object hk, Object hv) ;
    double increment(String key, Object hashKey, double delta);
    long increment(String key, Object hashKey, long delta);
    boolean hasKey(String key, Object hashKey);
    void putIfAbsent(String key, Object hashKey, Object value);
    void delete(String key, Object... hashKeys);
    <T> T get(String key, Object hashKey, Class<T> tClass);
    /* ----------- string --------- */

    <T> T get(String key, Class<T> clazz);

    String getStr(String key);

    <T> List<T> mget(Collection<String> keys, Class<T> clazz);

    <T> void set(String key, T obj, Long timeout, TimeUnit unit);

    <T> T getAndSet(String key, T obj, Class<T> clazz);

    int decrement(String key, int delta);

    int increment(String key, int delta);

    boolean setExpore(String key, Long timeout, TimeUnit timeUnit);

    int size(String key);

    <T> List<T> range(String key, long start, long end, Class<T> clazz);

    void rightPushAll(String key, Collection<?> values, Long timeout, TimeUnit unit);

    <T> void rightPush(String key, T obj);

    <T> void leftPush(String key, T obj);

    <T> T leftPop(String key, Class<T> clazz);

    void remove(String key, int count, Object obj);

    Long rank(String key, Object obj);

    <T> List<T> zrange(String key, long start, long end, Class<T> clazz);

    /* ----------- zset --------- */

    int zcard(String key);

    void zadd(String key, Object obj, double score);

    void zrem(String key, Object obj);

    void unionStore(String destKey, Collection<String> keys, Long timeout, TimeUnit unit);

    <T> List<T> reverseRange(String key, long start, long end, Class<T> clazz);

    Set reverseRangeWithScores(String key, long start, long end);

    Double score(String key, Object obj);


}
